<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>主页面</title>
</head>
<body>
<a href="/addInfo" th:href="@{/addInfo}">添加用户信息</a><br>
<a href="/getLog" th:href="@{/getLog}">查看日志</a>
<table border="1" align="center">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>手机号</th>
        <th>身份证号</th>
        <th>省份</th>
        <th>城市</th>
        <th>邮箱</th>
        <th>备注</th>
        <th>操作</th>
    </tr>
    <tr th:each="u:${userInfoList }">
        <td th:text="${uStat.count}">编号</td>
        <td th:text="${u.userName}">姓名</td>
        <td th:text="${u.phone}">手机号码</td>
        <td th:text="${u.idCard}">身份证号</td>
        <td th:text="${u.province}">省份</td>
        <td th:text="${u.city}">城市</td>
        <td th:text="${u.email}">邮箱</td>
        <td th:text="${u.remark}">备注</td>
        <td>
            <a href="javascript:del(1)" th:href="@{|javascript:del(${u.id})|}">删除用户</a>
            <a href="/selOneInfo" th:href="@{|/selOneInfo?id=${u.id}|}">更新用户</a>
        </td>
    </tr>
</table>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
    function del(id) {
            $.ajax({
                url:"[[@{delInfo}]]",
                type:"post",
                data:{"id":id},
                dataType:"json",
                success:function(data){
                    if(data.code==1){
                        alert(data.message);
                        location.reload()
                    }else {
                        alert(data.message)

                    }
                }
            })
    }
</script>
</html>